home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Other Langs / xlisp / XLisp 1.4 / xlisp 1.4.doc next >
Encoding:
Text File  |  1985-03-13  |  52.1 KB  |  1,361 lines  |  [TEXT/MACA]

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.             XLISP: An Experimental Object Oriented Language
  9.  
  10.                               Version 1.4
  11.  
  12.                             January 1, 1985
  13.  
  14.  
  15.                                    by
  16.                                David Betz
  17.                            114 Davenport Ave.
  18.                          Manchester, NH  03103
  19.  
  20.                          (603) 625-4691 (home)
  21.  
  22.  
  23.  
  24.       XLISP: An Experimental Object Oriented Language                 Page 2
  25.       TABLE OF CONTENTS
  26.  
  27.  
  28.               1.0     INTRODUCTION . . . . . . . . . . . . . . . . . . . . 3
  29.               2.0     A NOTE FROM THE AUTHOR . . . . . . . . . . . . . . . 4
  30.               3.0     XLISP COMMAND LOOP . . . . . . . . . . . . . . . . . 5
  31.               4.0     BREAK COMMAND LOOP . . . . . . . . . . . . . . . . . 6
  32.               5.0     DATA TYPES . . . . . . . . . . . . . . . . . . . . . 7
  33.               6.0     THE EVALUATOR  . . . . . . . . . . . . . . . . . . . 8
  34.               7.0     LEXICAL CONVENTIONS  . . . . . . . . . . . . . . . . 9
  35.               8.0     OBJECTS  . . . . . . . . . . . . . . . . . . . . .  10
  36.               9.0     SYMBOLS  . . . . . . . . . . . . . . . . . . . . .  13
  37.               10.0    EVALUATION FUNCTIONS . . . . . . . . . . . . . . .  14
  38.               11.0    SYMBOL FUNCTIONS . . . . . . . . . . . . . . . . .  15
  39.               12.0    PROPERTY LIST FUNCTIONS  . . . . . . . . . . . . .  17
  40.               13.0    LIST FUNCTIONS . . . . . . . . . . . . . . . . . .  18
  41.               14.0    DESTRUCTIVE LIST FUNCTIONS . . . . . . . . . . . .  21
  42.               15.0    PREDICATE FUNCTIONS  . . . . . . . . . . . . . . .  22
  43.               16.0    CONTROL FUNCTIONS  . . . . . . . . . . . . . . . .  24
  44.               17.0    LOOPING FUNCTIONS  . . . . . . . . . . . . . . . .  25
  45.               18.0    THE PROGRAM FEATURE  . . . . . . . . . . . . . . .  26
  46.               19.0    DEBUGGING AND ERROR HANDLING . . . . . . . . . . .  27
  47.               20.0    ARITHMETIC FUNCTIONS . . . . . . . . . . . . . . .  28
  48.               21.0    BITWISE LOGICAL FUNCTIONS  . . . . . . . . . . . .  29
  49.               22.0    RELATIONAL FUNCTIONS . . . . . . . . . . . . . . .  30
  50.               23.0    STRING FUNCTIONS . . . . . . . . . . . . . . . . .  31
  51.               24.0    INPUT/OUTPUT FUNCTIONS . . . . . . . . . . . . . .  32
  52.               25.0    FILE I/O FUNCTIONS . . . . . . . . . . . . . . . .  33
  53.               26.0    SYSTEM FUNCTIONS . . . . . . . . . . . . . . . . .  34
  54.  
  55.  
  56.  
  57.       XLISP: An Experimental Object Oriented Language                 Page 3
  58.       INTRODUCTION
  59.  
  60.  
  61.       1.0  INTRODUCTION
  62.  
  63.       XLISP is an experimental programming language combining some
  64.       of  the  features  of LISP with an object oriented extension
  65.       capability.  It was  implemented  to  allow  experimentation
  66.       with  object oriented programming on small computers.  There
  67.       are currently implementations running on  the  PDP-11  under
  68.       UNIX  V7, on the VAX-11 under VAX/VMS and Berkeley VAX/UNIX,
  69.       and on the 8088/8086 under CP/M-86 or MS-DOS.  A version  is
  70.       currently  being  developed for the 68000 under CP/M-68K and
  71.       for the Apple Macintosh.  It is completely  written  in  the
  72.       programming  language  'C'  and is easily extended with user
  73.       written built-in functions and classes.  It is available  in
  74.       source   form   free  of  charge  to  non-commercial  users.
  75.       Prospective commercial users should contact the  author  for
  76.       permission to use XLISP.
  77.  
  78.       Many traditional LISP functions are built  into  XLISP.   In
  79.       addition,  XLISP defines the objects 'Object' and 'Class' as
  80.       primitives.   'Object'  is  the  only  class  that  has   no
  81.       superclass  and  hence  is  the  root of the class heirarchy
  82.       tree.  'Class'  is  the  class  of  which  all  classes  are
  83.       instances  (it  is  the  only  object that is an instance of
  84.       itself).
  85.  
  86.       This document is intended  to  be  a  brief  description  of
  87.       XLISP.    It   assumes  some  knowledge  of  LISP  and  some
  88.       understanding   of   the   concepts   of   object   oriented
  89.       programming.
  90.  
  91.       Version 1.2 of XLISP differs from  version  1.1  in  several
  92.       ways.   It  supports  many  more Lisp functions.  Also, many
  93.       version 1.1  functions  have  been  renamed  and/or  changed
  94.       slightly  to follow traditional Lisp usage.  One of the most
  95.       frequently reported problems in version  1.1  resulted  from
  96.       many  functions being named after their equivilent functions
  97.       in the C language.  This turned  out  to  be  confusing  for
  98.       people who were trying to learn XLISP using traditional LISP
  99.       texts as references.  Version 1.2 renames these functions to
  100.       be  compatible  with  more  traditional  dialects  of  LISP.
  101.       Version 1.3 introduces many new  LISP  functions  and  moves
  102.       closer  to the goal of being compatible with the Common Lisp
  103.       standard.  Version 1.4 introduces user  error  handling  and
  104.       breakpoint  support  as  well as more Common Lisp compatible
  105.       functions.
  106.  
  107.       A recommended text for learning LISP programming is the book
  108.       "LISP"  by Winston and Horn and published by Addison Wesley.
  109.       The first edition of this book is based on MacLisp  and  the
  110.       second  edition is based on Common Lisp.  Future versions of
  111.       XLISP will continue to migrate  towards  compatibility  with
  112.       Common Lisp.
  113.  
  114.  
  115.  
  116.       XLISP: An Experimental Object Oriented Language                 Page 4
  117.       A NOTE FROM THE AUTHOR
  118.  
  119.  
  120.       2.0  A NOTE FROM THE AUTHOR
  121.  
  122.       If you have any problems with XLISP, feel free to contact me
  123.       for  help  or  advice.   Please remember that since XLISP is
  124.       available in source form in  a  high  level  language,  many
  125.       users  have  been  making versions available on a variety of
  126.       machines.  If you call to report a problem with  a  specific
  127.       version,  I may not be able to help you if that version runs
  128.       on a machine to which I don't have access.  Please have  the
  129.       version  number  of the version that you are running readily
  130.       accessible before calling me.
  131.  
  132.       If you find a bug  in  XLISP,  first  try  to  fix  the  bug
  133.       yourself  using  the  source  code  provided.   If  you  are
  134.       successful in fixing the bug, send the bug report along with
  135.       the  fix to me.  If you don't have access to a C compiler or
  136.       are unable to fix a bug, please send the bug  report  to  me
  137.       and I'll try to fix it.
  138.  
  139.       Any suggestions for improvements  will  be  welcomed.   Feel
  140.       free  to  extend  the  language  in  whatever way suits your
  141.       needs.  However, PLEASE DO  NOT  RELEASE  ENHANCED  VERSIONS
  142.       WITHOUT  CHECKING  WITH  ME  FIRST!!  I would like to be the
  143.       clearing house for new features added to XLISP.  If you want
  144.       to  add  features for your own personal use, go ahead.  But,
  145.       if you want to distribute your enhanced version, contact  me
  146.       first.  Please remember that the goal of XLISP is to provide
  147.       a language to learn and  experiment  with  LISP  and  object
  148.       oriented programming on small computers.
  149.  
  150.  
  151.  
  152.       XLISP: An Experimental Object Oriented Language                 Page 5
  153.       XLISP COMMAND LOOP
  154.  
  155.  
  156.       3.0  XLISP COMMAND LOOP
  157.  
  158.       When XLISP is started, it first  tries  to  load  "init.lsp"
  159.       from  the  default directory.  It then loads any files named
  160.       as parameters on the command line (after appending ".lsp" to
  161.       their names).  It then issues the following prompt:
  162.  
  163.       >
  164.  
  165.       This indicates that XLISP is waiting for an expression to be
  166.       typed.   When  an  incomplete expression has been typed (one
  167.       where the left and right parens don't match)  XLISP  changes
  168.       its prompt to:
  169.  
  170.       n>
  171.  
  172.       where n is an integer indicating how  many  levels  of  left
  173.       parens remain unclosed.
  174.  
  175.       When a complete expression has been entered, XLISP  attempts
  176.       to  evaluate  that  expression.  If the expression evaluates
  177.       successfully, XLISP prints the result of the evaluation  and
  178.       then  returns  to  the  initial  prompt  waiting for another
  179.       expression to be typed.
  180.  
  181.       Input can be aborted at any time by typing the CONTROL-G key
  182.       (it may be necessary to follow CONTROL-G by RETURN).
  183.  
  184.  
  185.  
  186.       XLISP: An Experimental Object Oriented Language                 Page 6
  187.       BREAK COMMAND LOOP
  188.  
  189.  
  190.       4.0  BREAK COMMAND LOOP
  191.  
  192.       When  XLISP  encounters  an  error   while   evaluating   an
  193.       expression, it attempts to handle the error in the following
  194.       way:
  195.  
  196.       If  the  symbol  '*breakenable*'  is   true,   the   message
  197.       corresponding  to  the  error  is  printed.  If the error is
  198.       correctable, the correction  message  is  printed.   If  the
  199.       symbol '*tracenable*' is true, a trace back is printed.  The
  200.       number of entries printed depends on the value of the symbol
  201.       '*tracelimit*'.   If  this  symbol is set to something other
  202.       than a number, the  entire  trace  back  stack  is  printed.
  203.       XLISP  then  enters a read/eval/print loop to allow the user
  204.       to examine the state of the interpreter in  the  context  of
  205.       the  error.   This  loop  differs  from the normal top-leval
  206.       read/eval/print loop in that if the user  types  the  symbol
  207.       'continue' XLISP will continue from a correctable error.  If
  208.       the user types the symbol 'quit' XLISP will abort the  break
  209.       loop  and return to the top level or the next lower numbered
  210.       break loop.  When in a break loop, XLISP prefixes the  break
  211.       level to the normal prompt.
  212.  
  213.       If the symbol '*breakenable*' is  nil,  XLISP  looks  for  a
  214.       surrounding   errset  function.   If  one  is  found,  XLISP
  215.       examines the value of the print flag.  If this flag is true,
  216.       the error message is printed.  In any case, XLISP causes the
  217.       errset function call to return nil.
  218.  
  219.       If there is no surrounding errset function, XLISP prints the
  220.       error message and returns to the top level.
  221.  
  222.  
  223.  
  224.       XLISP: An Experimental Object Oriented Language                 Page 7
  225.       DATA TYPES
  226.  
  227.  
  228.       5.0  DATA TYPES
  229.  
  230.       There are several different data types  available  to  XLISP
  231.       programmers.
  232.  
  233.  
  234.             o  lists
  235.  
  236.             o  symbols
  237.  
  238.             o  strings
  239.  
  240.             o  integers
  241.  
  242.             o  objects
  243.  
  244.             o  file pointers
  245.  
  246.             o  subrs/fsubrs (built-in functions)
  247.  
  248.       Another data type is the stream.  A stream is  a  list  node
  249.       whose car points to the head of a list of integers and whose
  250.       cdr points to the last list node  of  the  list.   An  empty
  251.       stream  is  a  list node whose car and cdr are nil.  Each of
  252.       the integers in the  list  represents  a  character  in  the
  253.       stream.   When  a character is read from a stream, the first
  254.       integer from the head of the list is removed  and  returned.
  255.       When  a  character  is  written  to  a  stream,  the integer
  256.       representing the character code of the character is appended
  257.       to  the  end of the list.  When a function indicates that it
  258.       takes an input source as a  parameter,  this  parameter  can
  259.       either  be  an  input  file pointer or a stream.  Similarly,
  260.       when a function indicates that it takes an output sink as  a
  261.       parameter,  this  parameter  can  either  be  an output file
  262.       pointer or a stream.
  263.  
  264.  
  265.  
  266.       XLISP: An Experimental Object Oriented Language                 Page 8
  267.       THE EVALUATOR
  268.  
  269.  
  270.       6.0  THE EVALUATOR
  271.  
  272.       The process of evaluation in XLISP:
  273.  
  274.             o  Integers,  strings,  objects,  file  pointers,  and
  275.                subrs evaluate to themselves
  276.  
  277.             o  Symbols evaluate to the value associated with their
  278.                current binding
  279.  
  280.             o  Lists are evaluated by evaluating the first element
  281.                of the list
  282.  
  283.                 o  If it evaluates to a subr, the  remaining  list
  284.                    elements  are  evaluated and the subr is called
  285.                    with these evaluated expressions as arguments.
  286.  
  287.                 o  If it evaluates  to  an  fsubr,  the  fsubr  is
  288.                    called  using  the  remaining  list elements as
  289.                    arguments  (they  are  evaluated  by  the  subr
  290.                    itself if necessary)
  291.  
  292.                 o  If it evaluates to a list and the  car  of  the
  293.                    list  is  'lambda', the remaining list elements
  294.                    are evaluated and the resulting expressions are
  295.                    bound  to  the  formal  arguments of the lambda
  296.                    expression.   The  body  of  the  function   is
  297.                    executed within this new binding environment.
  298.  
  299.                 o  If it evaluates to a list and the  car  of  the
  300.                    list  is  'macro',  the remaining list elements
  301.                    are bound to the formal arguments of the  macro
  302.                    expression.    The  body  of  the  function  is
  303.                    executed within this new  binding  environment.
  304.                    The result of this evaluation is considered the
  305.                    macro expansion.  This result is then evaluated
  306.                    in place of the original expression.
  307.  
  308.                 o  If it evaluates to an object, the  second  list
  309.                    element  is  evaluated  and  used  as a message
  310.                    selector.  The message formed by combining  the
  311.                    selector  with the values of the remaining list
  312.                    elements is sent to the object.
  313.  
  314.  
  315.  
  316.  
  317.  
  318.       XLISP: An Experimental Object Oriented Language                 Page 9
  319.       LEXICAL CONVENTIONS
  320.  
  321.  
  322.       7.0  LEXICAL CONVENTIONS
  323.  
  324.       The following conventions are followed when  entering  XLISP
  325.       programs:
  326.  
  327.       Comments in XLISP code begin with a semi-colon character and
  328.       continue to the end of the line.
  329.  
  330.       Symbol names  in  XLISP  can  consist  of  any  sequence  of
  331.       non-blank printable characters except the following:
  332.  
  333.               ( ) ' ` , " ;
  334.  
  335.       Upper and lower case characters are distinct.   The  symbols
  336.       'CAR' and 'car' are not the same.  The names of all built-in
  337.       functions are in lower case.   The  names  of  all  built-in
  338.       objects  are  lower  case  with  an initial capital.  Symbol
  339.       names must not begin with a digit.
  340.  
  341.       Integer literals consist of a sequence of digits  optionally
  342.       beginning with a '+' or '-'.  The range of values an integer
  343.       can represent is limited by the size of a  C  'int'  on  the
  344.       machine that XLISP is running on.
  345.  
  346.       Literal strings are sequences of  characters  surrounded  by
  347.       double  quotes.   Within quoted strings the '\' character is
  348.       used to allow non-printable characters to be included.   The
  349.       codes recognized are:
  350.  
  351.               \\      means the character '\'
  352.               \n      means newline
  353.               \t      means tab
  354.               \r      means return
  355.               \e      means escape
  356.               \nnn    means the character whose octal code is nnn
  357.  
  358.       XLISP defines several useful read macros:
  359.  
  360.               '<expr>  == (quote <expr>)
  361.               #'<expr> == (function <expr>)
  362.               `<expr>  == (backquote <expr>)
  363.               ,<expr>  == (comma <expr>)
  364.               ,@<expr> == (comma-at <expr>)
  365.  
  366.  
  367.  
  368.       XLISP: An Experimental Object Oriented Language                Page 10
  369.       OBJECTS
  370.  
  371.  
  372.       8.0  OBJECTS
  373.  
  374.       Definitions:
  375.  
  376.             o  selector - a symbol used to select  an  appropriate
  377.                method
  378.  
  379.             o  message - a selector and a list of actual arguments
  380.  
  381.             o  method - the code that implements a message
  382.  
  383.       Since XLISP was  created  to  provide  a  simple  basis  for
  384.       experimenting  with  object oriented programming, one of the
  385.       primitive data types included was 'object'.   In  XLISP,  an
  386.       object  consists of a data structure containing a pointer to
  387.       the object's class as well as a list containing  the  values
  388.       of the object's instance variables.
  389.  
  390.       Officially, there is no way to see inside an object (look at
  391.       the  values  of  its  instance  variables).  The only way to
  392.       communicate with an object is by sending it a message.  When
  393.       the  XLISP  evaluator  evaluates  a  list the value of whose
  394.       first element is an object, it interprets the value  of  the
  395.       second  element  of the list (which must be a symbol) as the
  396.       message selector.  The evaluator determines the class of the
  397.       receiving object and attempts to find a method corresponding
  398.       to the message selector in the set of messages  defined  for
  399.       that  class.   If  the  message is not found in the object's
  400.       class and the class has a super-class, the search  continues
  401.       by  looking  at  the  messages  defined for the super-class.
  402.       This process continues from  one  super-class  to  the  next
  403.       until  a  method  for the message is found.  If no method is
  404.       found, an error occurs.
  405.  
  406.       When a method is found, the evaluator  binds  the  receiving
  407.       object  to  the  symbol 'self', binds the class in which the
  408.       method was found to the symbol 'msgclass', and evaluates the
  409.       method  using the remaining elements of the original list as
  410.       arguments  to  the  method.   These  arguments  are   always
  411.       evaluated prior to being bound to their corresponding formal
  412.       arguments.  The result of evaluating the method becomes  the
  413.       result of the expression.
  414.  
  415.  
  416.  
  417.       XLISP: An Experimental Object Oriented Language                Page 11
  418.       OBJECTS
  419.  
  420.  
  421.       Classes:
  422.  
  423.       Object  THE TOP OF THE CLASS HEIRARCHY
  424.  
  425.           Messages:
  426.  
  427.               show    SHOW AN OBJECT'S INSTANCE VARIABLES
  428.                   returns     the object
  429.  
  430.               class   RETURN THE CLASS OF AN OBJECT
  431.                   returns     the class of the object
  432.  
  433.               isnew   THE DEFAULT OBJECT INITIALIZATION ROUTINE
  434.                   returns     the object
  435.  
  436.               sendsuper <sel> [<args>...] SEND SUPERCLASS A MESSAGE
  437.                   <sel>       the message selector
  438.                   <args>      the message arguments
  439.                   returns     the result of sending the message
  440.  
  441.  
  442.  
  443.       XLISP: An Experimental Object Oriented Language                Page 12
  444.       OBJECTS
  445.  
  446.  
  447.       Class   THE CLASS OF ALL OBJECT CLASSES (including itself)
  448.  
  449.           Messages:
  450.  
  451.               new     CREATE A NEW INSTANCE OF A CLASS
  452.                   returns     the new class object
  453.  
  454.               isnew [<scls>]  INITIALIZE A NEW CLASS
  455.                   <scls>      the superclass
  456.                   returns     the new class object
  457.  
  458.               answer <msg> <fargs> <code>     ADD A MESSAGE TO A CLASS
  459.                   <msg>       the message symbol
  460.                   <fargs>     the formal argument list
  461.                                 this list is of the form:
  462.                                   (<farg>...
  463.                                    [&optional <oarg>...]
  464.                                    [&rest <rarg>]
  465.                                    [&aux <aux>...])
  466.                                 where
  467.                                   <farg>   a formal argument
  468.                                   <oarg>   an optional argument (default is nil)
  469.                                   <rarg>   bound to the rest of the arguments
  470.                                   <aux>    a auxiliary variable (set to nil)
  471.                   <code>      a list of executable expressions
  472.                   returns     the object
  473.  
  474.               ivars <vars>    DEFINE THE LIST OF INSTANCE VARIABLES
  475.                   <vars>      the list of instance variable symbols
  476.                   returns     the object
  477.  
  478.               cvars <vars>    DEFINE THE LIST OF CLASS VARIABLES
  479.                   <vars>      the list of class variable symbols
  480.                   returns     the object
  481.  
  482.  
  483.       When a new instance of a class is  created  by  sending  the
  484.       message  'new'  to  an  existing  class, the message 'isnew'
  485.       followed by whatever parameters were  passed  to  the  'new'
  486.       message is sent to the newly created object.
  487.  
  488.       When a new class is created by sending the 'new' message  to
  489.       the  object  'Class', an optional parameter may be specified
  490.       indicating  the  superclass  of  the  new  class.   If  this
  491.       parameter  is  omitted,  the new class will be a subclass of
  492.       'Object'.  A class inherits all  instance  variables,  class
  493.       variables, and methods from its super-class.
  494.  
  495.  
  496.  
  497.       XLISP: An Experimental Object Oriented Language                Page 13
  498.       SYMBOLS
  499.  
  500.  
  501.       9.0  SYMBOLS
  502.  
  503.  
  504.             o  self  -  the  current  object  (within  a   message
  505.                context)
  506.  
  507.             o  msgclass - the class in which  the  current  method
  508.                was found
  509.  
  510.             o  *oblist* - the object list
  511.  
  512.             o  *keylist* - the keyword list
  513.  
  514.             o  *standard-input* - the standard input file
  515.  
  516.             o  *standard-output* - the standard output file
  517.  
  518.             o  *breakenable* - flag controlling entering the break
  519.                loop on errors
  520.  
  521.             o  *tracenable* - flag controlling trace back printout
  522.                on errors and breaks
  523.  
  524.             o  *tracelimit* - maximum number of  levels  of  trace
  525.                back information printed on errors and breaks
  526.  
  527.             o  *evalhook* -  user  substitute  for  the  evaluator
  528.                function
  529.  
  530.             o  *applyhook* - (not yet implemented)
  531.  
  532.             o  *unbound* - indicator for unbound symbols
  533.  
  534.  
  535.  
  536.  
  537.       XLISP: An Experimental Object Oriented Language                Page 14
  538.       EVALUATION FUNCTIONS
  539.  
  540.  
  541.       10.0  EVALUATION FUNCTIONS
  542.  
  543.       (eval <expr>)  EVALUATE AN XLISP EXPRESSION
  544.           <expr>      the expression to be evaluated
  545.           returns     the result of evaluating the expression
  546.  
  547.       (apply <fun> <args>)  APPLY A FUNCTION TO A LIST OF ARGUMENTS
  548.           <fun>       the function to apply (or function symbol)
  549.           <args>      the argument list
  550.           returns     the result of applying the function to the argument list
  551.  
  552.       (funcall <fun> <arg>...)  CALL A FUNCTION WITH ARGUMENTS
  553.           <fun>       the function to call (or function symbol)
  554.           <arg>       arguments to pass to the function
  555.           returns     the result of calling the function with the arguments
  556.  
  557.       (quote <expr>)  RETURN AN EXPRESSION UNEVALUATED
  558.           <expr>      the expression to be quoted (quoted)
  559.           returns     <expr> unevaluated
  560.  
  561.       (function <expr>)  QUOTE A FUNCTION (THIS IS THE SAME AS QUOTE)
  562.           <expr>      the function to be quoted (quoted)
  563.           returns     <expr> unevaluated
  564.  
  565.       (backquote <expr>)  FILL IN A TEMPLATE
  566.           <expr>      the template
  567.           returns     a copy of the template with comma and comma-at expressions
  568.                       expanded (see the Common Lisp reference manual)
  569.  
  570.  
  571.  
  572.       XLISP: An Experimental Object Oriented Language                Page 15
  573.       SYMBOL FUNCTIONS
  574.  
  575.  
  576.       11.0  SYMBOL FUNCTIONS
  577.  
  578.       (set <sym> <expr>)  SET THE VALUE OF A SYMBOL
  579.           <sym>       the symbol being set
  580.           <expr>      the new value
  581.           returns     the new value
  582.  
  583.       (setq [<sym> <expr>]...)  SET THE VALUE OF A SYMBOL
  584.           <sym>       the symbol being set (quoted)
  585.           <expr>      the new value
  586.           returns     the new value
  587.  
  588.       (setf [<place> <expr>]...)  SET THE VALUE OF A FIELD
  589.           <place>     the field specifier (quoted):
  590.                           <sym>                set the value of a symbol
  591.                           (car <expr>)         set the car of a list node
  592.                           (cdr <expr>)         set the cdr of a list node
  593.                           (get <sym> <prop>)   set the value of a property
  594.                           (symbol-value <sym>) set the value of a symbol
  595.                           (symbol-plist <sym>) set the property list of a symbol
  596.           <value>     the new value
  597.           returns     the new value
  598.  
  599.       (defun <sym> <fargs> <expr>...)  DEFINE A FUNCTION
  600.       (defmacro <sym> <fargs> <expr>...)  DEFINE A MACRO
  601.           <sym>       symbol being defined (quoted)
  602.           <fargs>     list of formal arguments (quoted)
  603.                         this list is of the form:
  604.                           (<farg>...
  605.                            [&optional <oarg>...]
  606.                            [&rest <rarg>]
  607.                            [&aux <aux>...])
  608.                         where
  609.                           <farg>      is a formal argument
  610.                           <oarg>      is an optional argument (default is nil)
  611.                           <rarg>      bound to the rest of the arguments
  612.                           <aux>       is an auxiliary variable (set to nil)
  613.           <expr>      expressions constituting the body of the
  614.                       function (quoted)
  615.           returns     the function symbol
  616.  
  617.       (gensym [<tag>])  GENERATE A SYMBOL
  618.           <tag>       string or number
  619.           returns     the new symbol
  620.  
  621.       (intern <pname>)  MAKE AN INTERNED SYMBOL
  622.           <pname>     the symbol's print name string
  623.           returns     the new symbol
  624.  
  625.       (make-symbol <pname>)  MAKE AN UNINTERNED SYMBOL
  626.           <pname>     the symbol's print name string
  627.           returns     the new symbol
  628.  
  629.  
  630.  
  631.       XLISP: An Experimental Object Oriented Language                Page 16
  632.       SYMBOL FUNCTIONS
  633.  
  634.  
  635.       (symbol-name <sym>)  GET THE PRINT NAME OF A SYMBOL
  636.           <sym>       the symbol
  637.           returns     the symbol's print name
  638.  
  639.       (symbol-value <sym>)  GET THE VALUE OF A SYMBOL
  640.           <sym>       the symbol
  641.           returns     the symbol's value
  642.  
  643.       (symbol-plist <sym>)  GET THE PROPERTY LIST OF A SYMBOL
  644.           <sym>       the symbol
  645.           returns     the symbol's property list
  646.  
  647.  
  648.  
  649.       XLISP: An Experimental Object Oriented Language                Page 17
  650.       PROPERTY LIST FUNCTIONS
  651.  
  652.  
  653.       12.0  PROPERTY LIST FUNCTIONS
  654.  
  655.       (get <sym> <prop>)  GET THE VALUE OF A PROPERTY
  656.           <sym>       the symbol
  657.           <prop>      the property symbol
  658.           returns     the property value or nil
  659.  
  660.       (remprop <prop> <sym>)  REMOVE A PROPERTY
  661.           <sym>       the symbol
  662.           <prop>      the property symbol
  663.           returns     nil
  664.  
  665.  
  666.  
  667.       XLISP: An Experimental Object Oriented Language                Page 18
  668.       LIST FUNCTIONS
  669.  
  670.  
  671.       13.0  LIST FUNCTIONS
  672.  
  673.       (car <expr>)  RETURN THE CAR OF A LIST NODE
  674.           <expr>      the list node
  675.           returns     the car of the list node
  676.  
  677.       (cdr <expr>)  RETURN THE CDR OF A LIST NODE
  678.           <expr>      the list node
  679.           returns     the cdr of the list node
  680.  
  681.       (caar <expr>) == (car (car <expr>))
  682.       (cadr <expr>) == (car (cdr <expr>))
  683.       (cdar <expr>) == (cdr (car <expr>))
  684.       (cddr <expr>) == (cdr (cdr <expr>))
  685.  
  686.       (cons <expr1> <expr2>)  CONSTRUCT A NEW LIST NODE
  687.           <expr1>     the car of the new list node
  688.           <expr2>     the cdr of the new list node
  689.           returns     the new list node
  690.  
  691.       (list <expr>...)  CREATE A LIST OF VALUES
  692.           <expr>      expressions to be combined into a list
  693.           returns     the new list
  694.  
  695.       (append <expr>...)  APPEND LISTS
  696.           <expr>      lists whose elements are to be appended
  697.           returns     the new list
  698.  
  699.       (reverse <expr>)  REVERSE A LIST
  700.           <expr>      the list to reverse
  701.           returns     a new list in the reverse order
  702.  
  703.       (last <list>)  RETURN THE LAST LIST NODE OF A LIST
  704.           <list>      the list
  705.           returns     the last list node in the list
  706.  
  707.       (member <expr> <list> [<key> <test>])  FIND AN EXPRESSION IN A LIST
  708.           <expr>      the expression to find
  709.           <list>      the list to search
  710.           <key>       the keyword :test or :test-not
  711.           <test>      the test function (defaults to eql)
  712.           returns     the remainder of the list starting with the expression
  713.  
  714.       (assoc <expr> <alist> [<key> <test>])  FIND AN EXPRESSION IN AN A-LIST
  715.           <expr>      the expression to find
  716.           <alist>     the association list
  717.           <key>       the keyword :test or :test-not
  718.           <test>      the test function (defaults to eql)
  719.           returns     the alist entry or nil
  720.  
  721.  
  722.  
  723.       XLISP: An Experimental Object Oriented Language                Page 19
  724.       LIST FUNCTIONS
  725.  
  726.  
  727.       (remove <expr> <list> [<key> <test>])  REMOVE AN EXPRESSION FROM A LIST
  728.           <expr>      the expression to delete
  729.           <list>      the list
  730.           <key>       the keyword :test or :test-not
  731.           <test>      the test function (defaults to eql)
  732.           returns     the list with the matching expressions deleted
  733.  
  734.       (length <expr>)  FIND THE LENGTH OF A LIST
  735.           <expr>      the list
  736.           returns     the length of the list
  737.  
  738.       (nth <n> <list>)  RETURN THE NTH ELEMENT OF A LIST
  739.           <n>         the number of the element to return (zero origin)
  740.           <list>      the list
  741.           returns     the nth element or nil if the list isn't that long
  742.  
  743.       (nthcdr <n> <list>)  RETURN THE NTH CDR OF A LIST
  744.           <n>         the number of the element to return (zero origin)
  745.           <list>      the list
  746.           returns     the nth cdr or nil if the list isn't that long
  747.  
  748.       (mapc <fcn> <list1>...<listn>)  APPLY FUNCTION TO SUCCESSIVE CARS
  749.           <fcn>       the function or function name
  750.           <list1..n>  a list for each argument of the function
  751.           returns     the first list of arguments
  752.  
  753.       (mapcar <fcn> <list1>...<listn>)  APPLY FUNCTION TO SUCCESSIVE CARS
  754.           <fcn>       the function or function name
  755.           <list1..n>  a list for each argument of the function
  756.           returns     the list of values returned by each function invocation
  757.  
  758.       (mapl <fcn> <list1>...<listn>)  APPLY FUNCTION TO SUCCESSIVE CDRS
  759.           <fcn>       the function or function name
  760.           <list1..n>  a list for each argument of the function
  761.           returns     the first list of arguments
  762.  
  763.       (maplist <fcn> <list1>...<listn>)  APPLY FUNCTION TO SUCCESSIVE CDRS
  764.           <fcn>       the function or function name
  765.           <list1..n>  a list for each argument of the function
  766.           returns     the list of values returned by each function invocation
  767.  
  768.  
  769.  
  770.       XLISP: An Experimental Object Oriented Language                Page 20
  771.       LIST FUNCTIONS
  772.  
  773.  
  774.       (subst <to> <from> <expr> [<key> <test>])  SUBSTITUTE EXPRESSIONS
  775.           <to>        the new expression
  776.           <from>      the old expression
  777.           <expr>      the expression in which to do the substitutions
  778.           <key>       the keyword :test or :test-not
  779.           <test>      the test function (defaults to eql)
  780.           returns     the expression with substitutions
  781.  
  782.       (sublis <alist> <expr> [<key> <test>])  SUBSTITUTE USING AN A-LIST
  783.           <alist>     the association list
  784.           <expr>      the expression in which to do the substitutions
  785.           <key>       the keyword :test or :test-not
  786.           <test>      the test function (defaults to eql)
  787.           returns     the expression with substitutions
  788.  
  789.  
  790.  
  791.       XLISP: An Experimental Object Oriented Language                Page 21
  792.       DESTRUCTIVE LIST FUNCTIONS
  793.  
  794.  
  795.       14.0  DESTRUCTIVE LIST FUNCTIONS
  796.  
  797.       (rplaca <list> <expr>)  REPLACE THE CAR OF A LIST NODE
  798.           <list>      the list node
  799.           <expr>      the new value for the car of the list node
  800.           returns     the list node after updating the car
  801.  
  802.       (rplacd <list> <expr>)  REPLACE THE CDR OF A LIST NODE
  803.           <list>      the list node
  804.           <expr>      the new value for the cdr of the list node
  805.           returns     the list node after updating the cdr
  806.  
  807.       (nconc <list>...)  DESTRUCTIVELY CONCATENATE LISTS
  808.           <list>      lists to concatenate
  809.           returns     the result of concatenating the lists
  810.  
  811.       (delete <expr> <list> [<key> <test>])  DELETE AN EXPRESSION FROM A LIST
  812.           <expr>      the expression to delete
  813.           <list>      the list
  814.           <key>       the keyword :test or :test-not
  815.           <test>      the test function (defaults to eql)
  816.           returns     the list with the matching expressions deleted
  817.  
  818.  
  819.  
  820.       XLISP: An Experimental Object Oriented Language                Page 22
  821.       PREDICATE FUNCTIONS
  822.  
  823.  
  824.       15.0  PREDICATE FUNCTIONS
  825.  
  826.       (atom <expr>)  IS THIS AN ATOM?
  827.           <expr>      the expression to check
  828.           returns     t if the value is an atom, nil otherwise
  829.  
  830.       (symbolp <expr>)  IS THIS A SYMBOL?
  831.           <expr>      the expression to check
  832.           returns     t if the expression is a symbol, nil otherwise
  833.  
  834.       (numberp <expr>)  IS THIS A NUMBER?
  835.           <expr>      the expression to check
  836.           returns     t if the expression is a symbol, nil otherwise
  837.  
  838.       (null <expr>)  IS THIS AN EMPTY LIST?
  839.           <expr>      the list to check
  840.           returns     t if the list is empty, nil otherwise
  841.  
  842.       (not <expr>)  IS THIS FALSE?
  843.           <expr>      the expression to check
  844.           return      t if the expression is nil, nil otherwise
  845.  
  846.       (listp <expr>)  IS THIS A LIST?
  847.           <expr>      the expression to check
  848.           returns     t if the value is a list node or nil, nil otherwise
  849.  
  850.       (consp <expr>)  IS THIS A NON-EMPTY LIST?
  851.           <expr>      the expression to check
  852.           returns     t if the value is a list node, nil otherwise
  853.  
  854.       (boundp <sym>)  IS THIS A BOUND SYMBOL?
  855.           <sym>       the symbol
  856.           returns     t if a value is bound to the symbol, nil otherwise
  857.  
  858.  
  859.  
  860.       XLISP: An Experimental Object Oriented Language                Page 23
  861.       PREDICATE FUNCTIONS
  862.  
  863.  
  864.       (minusp <expr>)  IS THIS NUMBER NEGATIVE?
  865.           <expr>      the number to test
  866.           returns     t if the number is negative, nil otherwise
  867.  
  868.       (zerop <expr>)  IS THIS NUMBER ZERO?
  869.           <expr>      the number to test
  870.           returns     t if the number is zero, nil otherwise
  871.  
  872.       (plusp <expr>)  IS THIS NUMBER POSITIVE?
  873.           <expr>      the number to test
  874.           returns     t if the number is positive, nil otherwise
  875.  
  876.       (evenp <expr>)  IS THIS NUMBER EVEN?
  877.           <expr>      the number to test
  878.           returns     t if the number is even, nil otherwise
  879.  
  880.       (oddp <expr>)  IS THIS NUMBER ODD?
  881.           <expr>      the number to test
  882.           returns     t if the number is odd, nil otherwise
  883.  
  884.       (eq <expr1> <expr2>)  ARE THE EXPRESSIONS IDENTICAL?
  885.           <expr1>     the first expression
  886.           <expr2>     the second expression
  887.           returns     t if they are equal, nil otherwise
  888.  
  889.       (eql <expr1> <expr2>)  ARE THE EXPRESSIONS IDENTICAL?
  890.                               (WORKS WITH NUMBERS AND STRINGS)
  891.           <expr1>     the first expression
  892.           <expr2>     the second expression
  893.           returns     t if they are equal, nil otherwise
  894.  
  895.       (equal <expr1> <expr2>)  ARE THE EXPRESSIONS EQUAL?
  896.           <expr1>     the first expression
  897.           <expr2>     the second expression
  898.           returns     t if they are equal, nil otherwise
  899.  
  900.  
  901.  
  902.       XLISP: An Experimental Object Oriented Language                Page 24
  903.       CONTROL FUNCTIONS
  904.  
  905.  
  906.       16.0  CONTROL FUNCTIONS
  907.  
  908.       (cond <pair>...)  EVALUATE CONDITIONALLY
  909.           <pair>      pair consisting of:
  910.                           (<pred> <expr>...)
  911.                         where
  912.                           <pred>      is a predicate expression
  913.                           <expr>      evaluated if the predicate
  914.                                       is not nil
  915.           returns     the value of the first expression whose predicate
  916.                       is not nil
  917.  
  918.       (and <expr>...)  THE LOGICAL AND OF A LIST OF EXPRESSIONS
  919.           <expr>...   the expressions to be ANDed
  920.           returns     nil if any expression evaluates to nil,
  921.                       otherwise the value of the last expression
  922.                       (evaluation of expressions stops after the first
  923.                        expression that evaluates to nil)
  924.  
  925.       (or <expr>...)  THE LOGICAL OR OF A LIST OF EXPRESSIONS
  926.           <expr>...   the expressions to be ORed
  927.           returns     nil if all expressions evaluate to nil,
  928.                       otherwise the value of the first non-nil expression
  929.                       (evaluation of expressions stops after the first
  930.                        expression that does not evaluate to nil)
  931.  
  932.       (if <texpr> <expr1> [<expr2>])  EXECUTE EXPRESSIONS CONDITIONALLY
  933.           <texpr>     the test expression
  934.           <expr1>     the expression to be evaluated if texpr is non-nil
  935.           <expr2>     the expression to be evaluated if texpr is nil
  936.           returns     the value of the selected expression
  937.  
  938.       (let (<binding>...) <expr>...)  BIND SYMBOLS AND EVALUATE EXPRESSIONS
  939.       (let* (<binding>...) <expr>...)  LET WITH SEQUENTIAL BINDING
  940.           <binding>   the variable bindings each of which is either:
  941.                       1)  a symbol (which is initialized to nil)
  942.                       2)  a list whose car is a symbol and whose cadr
  943.                               is an initialization expression
  944.           <expr>...   the expressions to be evaluated
  945.           returns     the value of the last expression
  946.  
  947.       (catch <sym> [<expr>]...)  EVALUATE EXPRESSIONS AND CATCH THROWS
  948.           <sym>       the catch tag
  949.           <expr>...   expressions to evaluate
  950.           returns     the value of the last expression the throw expression
  951.  
  952.       (throw <sym> [<expr>])  THROW TO A CATCH
  953.           <sym>       the catch tag
  954.           <expr>      the value for the catch to return (defaults to nil)
  955.           returns     never returns
  956.  
  957.  
  958.  
  959.       XLISP: An Experimental Object Oriented Language                Page 25
  960.       LOOPING FUNCTIONS
  961.  
  962.  
  963.       17.0  LOOPING FUNCTIONS
  964.  
  965.       (do ([<binding>]...) (<texpr> [<rexpr>]...) [<expr>]...)
  966.       (do* ([<binding>]...) (<texpr> [<rexpr>]...) [<expr>]...)
  967.           <binding>   the variable bindings each of which is either:
  968.                       1)  a symbol (which is initialized to nil)
  969.                       2)  a list of the form: (<sym> <init> [<step>])
  970.                           where:
  971.                               <sym>  is the symbol to bind
  972.                               <init> is the initial value of the symbol
  973.                               <step> is a step expression
  974.           <texpr>     the termination test expression
  975.           <rexpr>...  result expressions (the default is nil)
  976.           <expr>...   the body of the loop (treated like an implicit prog)
  977.           returns     the value of the last result expression
  978.  
  979.       (dolist (<sym> <expr> [<rexpr>]) [<expr>]...)  LOOP THROUGH A LIST
  980.           <sym>       the symbol to bind to each list element
  981.           <expr>      the list expression
  982.           <rexpr>     the result expression (the default is nil)
  983.           <expr>...   the body of the loop (treated like an implicit prog)
  984.  
  985.       (dotimes (<sym> <expr> [<rexpr>]) [<expr>]...)  LOOP FROM ZERO TO N-1
  986.           <sym>       the symbol to bind to each value from 0 to n-1
  987.           <expr>      the number of times to loop
  988.           <rexpr>     the result expression (the default is nil)
  989.           <expr>...   the body of the loop (treated like an implicit prog)
  990.  
  991.  
  992.  
  993.       XLISP: An Experimental Object Oriented Language                Page 26
  994.       THE PROGRAM FEATURE
  995.  
  996.  
  997.       18.0  THE PROGRAM FEATURE
  998.  
  999.       (prog (<binding>...) [<expr>]...)  THE PROGRAM FEATURE
  1000.       (prog* (<binding>...) [<expr>]...)  PROG WITH SEQUENTIAL BINDING
  1001.           <binding>   the variable bindings each of which is either:
  1002.                       1)  a symbol (which is initialized to nil)
  1003.                       2)  a list whose car is a symbol and whose cadr
  1004.                               is an initialization expression
  1005.           <expr>      expressions to evaluate or tags (symbols)
  1006.           returns     nil or the argument passed to the return function
  1007.  
  1008.       (go <sym>)  GO TO A TAG WITHIN A PROG CONSTRUCT
  1009.           <sym>       the tag (quoted)
  1010.           returns     never returns
  1011.  
  1012.       (return [<expr>])  CAUSE A PROG CONSTRUCT TO RETURN A VALUE
  1013.           <expr>      the value (defaults to nil)
  1014.           returns     never returns
  1015.  
  1016.       (prog1 <expr1> [<expr>]...)  EXECUTE EXPRESSIONS SEQUENTIALLY
  1017.           <expr1>     the first expression to evaluate
  1018.           <expr>...   the remaining expressions to evaluate
  1019.           returns     the value of the first expression
  1020.  
  1021.       (prog2 <expr1> <expr2> [<expr>]...)  EXECUTE EXPRESSIONS SEQUENTIALLY
  1022.           <expr1>     the first expression to evaluate
  1023.           <expr2>     the second expression to evaluate
  1024.           <expr>...   the remaining expressions to evaluate
  1025.           returns     the value of the second expression
  1026.  
  1027.       (progn [<expr>]...)  EXECUTE EXPRESSIONS SEQUENTIALLY
  1028.           <expr>...   the expressions to evaluate
  1029.           returns     the value of the last expression (or nil)
  1030.  
  1031.  
  1032.  
  1033.       XLISP: An Experimental Object Oriented Language                Page 27
  1034.       DEBUGGING AND ERROR HANDLING
  1035.  
  1036.  
  1037.       19.0  DEBUGGING AND ERROR HANDLING
  1038.  
  1039.       (error <emsg> [<arg>])  SIGNAL A NON-CORRECTABLE ERROR
  1040.           <emsg>      the error message string
  1041.           <arg>       the argument expression (printed after the message)
  1042.           returns     never returns
  1043.  
  1044.       (cerror <cmsg> <emsg> [<arg>])  SIGNAL A CORRECTABLE ERROR
  1045.           <cmsg>      the continue message string
  1046.           <emsg>      the error message string
  1047.           <arg>       the argument expression (printed after the message)
  1048.           returns     nil when continued from the break loop
  1049.  
  1050.       (break [<bmsg> [<arg>]])  ENTER A BREAK LOOP
  1051.           <bmsg>      the break message string (defaults to "**BREAK**")
  1052.           <arg>       the argument expression (printed after the message)
  1053.           returns     nil when continued from the break loop
  1054.  
  1055.       (errset <expr> [<pflag>])  TRAP ERRORS
  1056.           <expr>      the expression to execute
  1057.           <pflag>     flag to control printing of the error message
  1058.           returns     the value of the last expression consed with nil
  1059.                       or nil on error
  1060.  
  1061.       (baktrace [<n>])  PRINT N LEVELS OF TRACE BACK INFORMATION
  1062.           <n>         the number of levels (defaults to all levels)
  1063.           returns     nil
  1064.  
  1065.       (evalhook <expr> <ehook> <ahook>)  EVALUATE AN EXPRESSION WITH HOOKS
  1066.           <expr>      the expression to evaluate
  1067.           <ehook>     the value for *evalhook*
  1068.           <ahook>     the value for *applyhook*
  1069.           returns     the result of evaluating the expression
  1070.  
  1071.  
  1072.  
  1073.       XLISP: An Experimental Object Oriented Language                Page 28
  1074.       ARITHMETIC FUNCTIONS
  1075.  
  1076.  
  1077.       20.0  ARITHMETIC FUNCTIONS
  1078.  
  1079.       (+ <expr>...)  ADD A LIST OF NUMBERS
  1080.           <expr>...   the numbers
  1081.           returns     the result of the addition
  1082.  
  1083.       (- <expr>...)  SUBTRACT A LIST OF NUMBERS OR NEGATE A SINGLE NUMBER
  1084.           <expr>...   the numbers
  1085.           returns     the result of the subtraction
  1086.  
  1087.       (* <expr>...)  MULTIPLY A LIST OF NUMBERS
  1088.           <expr>...   the numbers
  1089.           returns     the result of the multiplication
  1090.  
  1091.       (/ <expr>...)  DIVIDE A LIST OF NUMBERS
  1092.           <expr>...   the numbers
  1093.           returns     the result of the division
  1094.  
  1095.       (1+ <expr>)  ADD ONE TO A NUMBER
  1096.           <expr>      the number
  1097.           returns     the number plus one
  1098.  
  1099.       (1- <expr>)  SUBTRACT ONE FROM A NUMBER
  1100.           <expr>      the number
  1101.           returns     the number minus one
  1102.  
  1103.       (rem <expr>...)  REMAINDER OF A LIST OF NUMBERS
  1104.           <expr>...   the numbers
  1105.           returns     the result of the remainder operation
  1106.  
  1107.       (min <expr>...)  THE SMALLEST OF A LIST OF NUMBERS
  1108.           <expr>...   the expressions to be checked
  1109.           returns     the smallest number in the list
  1110.  
  1111.       (max <expr>...)  THE LARGEST OF A LIST OF NUMBERS
  1112.           <expr>...   the expressions to be checked
  1113.           returns     the largest number in the list
  1114.  
  1115.       (abs <expr>)  THE ABSOLUTE VALUE OF A NUMBER
  1116.           <expr>      the number
  1117.           returns     the absolute value of the number
  1118.  
  1119.  
  1120.  
  1121.       XLISP: An Experimental Object Oriented Language                Page 29
  1122.       BITWISE LOGICAL FUNCTIONS
  1123.  
  1124.  
  1125.       21.0  BITWISE LOGICAL FUNCTIONS
  1126.  
  1127.       (bit-and <expr>...)  THE BITWISE AND OF A LIST OF NUMBERS
  1128.           <expr>      the numbers
  1129.           returns     the result of the and operation
  1130.  
  1131.       (bit-ior <expr...)  THE BITWISE INCLUSIVE OR OF A LIST OF NUMBERS
  1132.           <expr>      the numbers
  1133.           returns     the result of the inclusive or operation
  1134.  
  1135.       (bit-xor <expr...)  THE BITWISE EXCLUSIVE OR OF A LIST OF NUMBERS
  1136.           <expr>      the numbers
  1137.           returns     the result of the exclusive or operation
  1138.  
  1139.       (bit-not <expr>)  THE BITWISE NOT OF A NUMBER
  1140.           <expr>      the number
  1141.           returns     the bitwise inversion of number
  1142.  
  1143.  
  1144.  
  1145.       XLISP: An Experimental Object Oriented Language                Page 30
  1146.       RELATIONAL FUNCTIONS
  1147.  
  1148.  
  1149.       22.0  RELATIONAL FUNCTIONS
  1150.  
  1151.       The relational functions can be used to compare integers  or
  1152.       strings.   The  functions  '='  and '/=' can also be used to
  1153.       compare other types.  The result  of  these  comparisons  is
  1154.       computed the same way as for 'eq'.
  1155.  
  1156.       (< <e1> <e2>)  TEST FOR LESS THAN
  1157.           <e1>        the left operand of the comparison
  1158.           <e2>        the right operand of the comparison
  1159.           returns     the result of comparing <e1> with <e2>
  1160.  
  1161.       (<= <e1> <e2>)  TEST FOR LESS THAN OR EQUAL TO
  1162.           <e1>        the left operand of the comparison
  1163.           <e2>        the right operand of the comparison
  1164.           returns     the result of comparing <e1> with <e2>
  1165.  
  1166.       (= <e1> <e2>)  TEST FOR EQUAL TO
  1167.           <e1>        the left operand of the comparison
  1168.           <e2>        the right operand of the comparison
  1169.           returns     the result of comparing <e1> with <e2>
  1170.  
  1171.       (/= <e1> <e2>)  TEST FOR NOT EQUAL TO
  1172.           <e1>        the left operand of the comparison
  1173.           <e2>        the right operand of the comparison
  1174.           returns     the result of comparing <e1> with <e2>
  1175.  
  1176.       (>= <e1> <e2>)  TEST FOR GREATER THAN OR EQUAL TO
  1177.           <e1>        the left operand of the comparison
  1178.           <e2>        the right operand of the comparison
  1179.           returns     the result of comparing <e1> with <e2>
  1180.  
  1181.       (> <e1> <e2>)  TEST FOR GREATER THAN
  1182.           <e1>        the left operand of the comparison
  1183.           <e2>        the right operand of the comparison
  1184.           returns     the result of comparing <e1> with <e2>
  1185.  
  1186.  
  1187.  
  1188.       XLISP: An Experimental Object Oriented Language                Page 31
  1189.       STRING FUNCTIONS
  1190.  
  1191.  
  1192.       23.0  STRING FUNCTIONS
  1193.  
  1194.       (strcat <expr>...)  CONCATENATE STRINGS
  1195.           <expr>...   the strings to concatenate
  1196.           returns     the result of concatenating the strings
  1197.  
  1198.       (strlen <expr>)  COMPUTE THE LENGTH OF A STRING
  1199.           <expr>      the string
  1200.           returns     the length of the string
  1201.  
  1202.       (substr <expr> <sexpr> [<lexpr>]) EXTRACT A SUBSTRING
  1203.           <expr>      the string
  1204.           <sexpr>     the starting position
  1205.           <lexpr>     the length (default is rest of string)
  1206.           returns     substring starting at <sexpr> for <lexpr>
  1207.  
  1208.       (ascii <expr>)  NUMERIC VALUE OF CHARACTER
  1209.           <expr>      the string
  1210.           returns     the ascii code of the first character
  1211.  
  1212.       (chr <expr>)  CHARACTER EQUIVALENT OF ASCII VALUE
  1213.           <expr>      the numeric expression
  1214.           returns     a one character string whose first character is <expr>
  1215.  
  1216.       (atoi <expr>)  CONVERT AN ASCII STRING TO AN INTEGER
  1217.           <expr>      the string
  1218.           returns     the integer value of the string expression
  1219.  
  1220.       (itoa <expr>)  CONVERT AN INTEGER TO AN ASCII STRING
  1221.           <expr>      the integer
  1222.           returns     the string representation of the integer value
  1223.  
  1224.  
  1225.  
  1226.       XLISP: An Experimental Object Oriented Language                Page 32
  1227.       INPUT/OUTPUT FUNCTIONS
  1228.  
  1229.  
  1230.       24.0  INPUT/OUTPUT FUNCTIONS
  1231.  
  1232.       (read [<source> [<eof>]])  READ AN XLISP EXPRESSION
  1233.           <source>    the input source (default is standard input)
  1234.           <eof>       the value to return on end of file (default is nil)
  1235.           returns     the expression read
  1236.  
  1237.       (print <expr> [<sink>])  PRINT A LIST OF VALUES ON A NEW LINE
  1238.           <expr>      the expressions to be printed
  1239.           <sink>      the output sink (default is standard output)
  1240.           returns     nil
  1241.  
  1242.       (prin1 <expr> [<sink>])  PRINT A LIST OF VALUES
  1243.           <expr>      the expressions to be printed
  1244.           <sink>      the output sink (default is standard output)
  1245.           returns     nil
  1246.  
  1247.       (princ <expr> [<sink>])  PRINT A LIST OF VALUES WITHOUT QUOTING
  1248.           <expr>      the expressions to be printed
  1249.           <sink>      the output sink (default is standard output)
  1250.           returns     nil
  1251.  
  1252.       (terpri [<sink>])  TERMINATE THE CURRENT PRINT LINE
  1253.           <sink>      the output sink (default is standard output)
  1254.           returns     nil
  1255.  
  1256.       (flatsize <expr>)  LENGTH OF PRINTED REPRESENTATION USING PRIN1
  1257.           <expr>      the expression
  1258.           returns     the length
  1259.  
  1260.       (flatc <expr>)  LENGTH OF PRINTED REPRESENTATION USING PRINC
  1261.           <expr>      the expression
  1262.           returns     the length
  1263.  
  1264.       (explode <expr>)  CHARACTERS IN PRINTED REPRESENTATION USING PRIN1
  1265.           <expr>      the expression
  1266.           returns     the list of characters
  1267.  
  1268.       (explodec <expr>)  CHARACTERS IN PRINTED REPRESENTATION USING PRINC
  1269.           <expr>      the expression
  1270.           returns     the list of characters
  1271.  
  1272.       (maknam <list>)  BUILD AN UNINTERNED SYMBOL FROM A LIST OF CHARACTERS
  1273.           <list>      list of characters in symbol name
  1274.           returns     the symbol
  1275.  
  1276.       (implode <list>)  BUILD AN INTERNED SYMBOL FROM A LIST OF CHARACTERS
  1277.           <list>      list of characters in symbol name
  1278.           returns     the symbol
  1279.  
  1280.  
  1281.  
  1282.       XLISP: An Experimental Object Oriented Language                Page 33
  1283.       FILE I/O FUNCTIONS
  1284.  
  1285.  
  1286.       25.0  FILE I/O FUNCTIONS
  1287.  
  1288.       (openi <fname>)  OPEN AN INPUT FILE
  1289.           <fname>     the file name string
  1290.           returns     a file pointer
  1291.  
  1292.       (openo <fname>)  OPEN AN OUTPUT FILE
  1293.           <fname>     the file name string
  1294.           returns     a file pointer
  1295.  
  1296.       (close <fp>)  CLOSE A FILE
  1297.           <fp>        the file pointer
  1298.           returns     nil
  1299.  
  1300.       (read-char [<source>])  READ A CHARACTER FROM A FILE OR STREAM
  1301.           <source>    the input source (default is standard input)
  1302.           returns     the character (integer)
  1303.  
  1304.       (peek-char [<flag> [<source>]])  PEEK AT THE NEXT CHARACTER
  1305.           <flag>      flag for skipping white space (default is nil)
  1306.           <source>    the input source (default is standard input)
  1307.           returns     the character (integer)
  1308.  
  1309.       (write-char <ch> [<sink>])  WRITE A CHARACTER TO A FILE OR STREAM
  1310.           <ch>        the character to put (integer)
  1311.           <sink>      the output sink (default is standard output)
  1312.           returns     the character (integer)
  1313.  
  1314.       (readline [<source>])  READ A LINE FROM A FILE OR STREAM
  1315.           <source>    the input source (default is standard input)
  1316.           returns     the input string
  1317.  
  1318.  
  1319.  
  1320.       XLISP: An Experimental Object Oriented Language                Page 34
  1321.       SYSTEM FUNCTIONS
  1322.  
  1323.  
  1324.       26.0  SYSTEM FUNCTIONS
  1325.  
  1326.       (load <fname> [<vflag> [<pflag>]])  LOAD AN XLISP SOURCE FILE
  1327.           <fname>     the filename string (".lsp" is appended)
  1328.           <vflag>     the verbose flag (default is t)
  1329.           <pflag>     the print flag (default is nil)
  1330.           returns     the filename
  1331.  
  1332.       (gc)  FORCE GARBAGE COLLECTION
  1333.           returns     nil
  1334.  
  1335.       (expand <num>)  EXPAND MEMORY BY ADDING SEGMENTS
  1336.           <num>       the number of segments to add
  1337.           returns     the number of segments added
  1338.  
  1339.       (alloc <num>)  CHANGE NUMBER OF NODES TO ALLOCATE IN EACH SEGMENT
  1340.           <num>       the number of nodes to allocate
  1341.           returns     the old number of nodes to allocate
  1342.  
  1343.       (mem)  SHOW MEMORY ALLOCATION STATISTICS
  1344.           returns     nil
  1345.  
  1346.       (type <expr>)  RETURNS THE TYPE OF THE EXPRESSION
  1347.           <expr>      the expression to return the type of
  1348.           returns     nil if the value is nil otherwise one of the symbols:
  1349.                           SYM   for symbols
  1350.                           OBJ   for objects
  1351.                           LIST  for list nodes
  1352.                           SUBR  for subroutine nodes with evaluated arguments
  1353.                           FSUBR for subroutine nodes with unevaluated arguments
  1354.                           STR   for string nodes
  1355.                           INT   for integer nodes
  1356.                           FPTR  for file pointer nodes
  1357.  
  1358.       (exit)  EXIT XLISP
  1359.           returns     never returns
  1360. /* End of text from uiucdcs:net.micro.mac */
  1361.